package com.snake.springboot.custom.controller.login;

import com.snake.springboot.custom.api.model.base.CustomAccountModel;
import com.snake.springboot.custom.api.model.login.LoginRedirectModel;
import com.snake.springboot.custom.api.service.login.CustomAccLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.snake.common.result.ResponseResult;
import org.snake.common.result.ResponseResultFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类 {@code CustomAccLoginController}  <br> .
 * <p>商户账号登录
 * <p>创建时间：2025/03/06
 *
 * @author Huang.yj
 */
@Api(tags = "商户管理-账号登录")
@RestController
@RequestMapping("/login")
public class CustomAccLoginController {

    private CustomAccLoginService customAccLoginService;

    public CustomAccLoginController(CustomAccLoginService customAccLoginService){
        this.customAccLoginService = customAccLoginService;
    }

    @ApiOperation("账号跳转页面登录")
    @PostMapping("/redirect_login")
    public ResponseResult<CustomAccountModel> redirectLogin(
            @ApiParam(name = "跳转登录入参", value = "传入json格式", required = true)
            @RequestBody LoginRedirectModel model) {
        CustomAccountModel result = customAccLoginService.redirectLogin(model);
        return ResponseResultFactory.ucc("登录成功！",result);
    }
}
